[...slug].astro

 1---
 2import { getCollection, render } from 'astro:content';
 3import fs from 'node:fs';
 4import path from 'node:path';
 5import Doc from '../../layouts/Doc.astro';
 6import { SKILL_CATEGORIES } from '../../data/sub-pages-data';
 7
 8export async function getStaticPaths() {
 9  const entries = await getCollection('skills');
10
11  const metadataPath = path.join(process.cwd(), 'skill/scripts/command-metadata.json');
12  const commandMetadata = JSON.parse(fs.readFileSync(metadataPath, 'utf-8'));
13
14  const allCommands = entries.map(e => ({
15    slug: e.id,
16    category: SKILL_CATEGORIES[e.id] || 'system',
17  }));
18
19  return entries.map(entry => ({
20    params: { slug: entry.id },
21    props: {
22      entry,
23      metadata: commandMetadata[entry.id] || { description: entry.data.tagline, argumentHint: '' },
24      allCommands,
25    },
26  }));
27}
28
29const { entry, metadata, allCommands } = Astro.props;
30const { Content } = await render(entry);
31const slug = entry.id;
32const category = SKILL_CATEGORIES[slug] || 'system';
33---
34
35<Doc
36  title={slug}
37  description={metadata.description}
38  tagline={entry.data.tagline}
39  slug={slug}
40  category={category}
41  allCommands={allCommands}
42>
43  <Content />
44</Doc>